package cn.alm.miniodemo.config;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MinioConfig {

    @Value("${minio.endpoint}")
    private String minioEndpoint;

    @Value("${minio.root.user}")
    private String minioUsername;

    @Value("${minio.root.password}")
    private String minioPassword;

    @Bean
    public MinioClient minioClient() {
        MinioClient minioClient = MinioClient.builder().endpoint(minioEndpoint).credentials(minioUsername, minioPassword).build();
        return minioClient;
    }
}
